package com.zy.algorithm.v3.sort

import android.os.Bundle
import android.view.View
import com.zy.activity.BaseFragment
import com.zy.algorithm.v3.R
import com.zy.view.DIYSortView

abstract class BaseV3SortFragment : BaseFragment() {
    override val layout: Int
        get() = R.layout.fragment_sort_merge

    var code: Int = 0

    lateinit var diyV4: DIYSortView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        code = arguments?.getInt("code", 0) ?: 0
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        diyV4 = view.findViewById(R.id.sort_view)
        val clickBlack = view.findViewById<View>(R.id.click_black)
        clickBlack.setOnLongClickListener {
            autoMove(diyV4)
            false
        }

        setSortData(diyV4)
    }

    protected open fun setSortData(diyV4: DIYSortView) {}
    protected open fun autoMove(diyV4: DIYSortView) {}
}